﻿
package extremefx.conditions {

	/**
	 * @author Marcelo Volmaro
	 */
	public final class BoolValidator extends Validator {
		public function BoolValidator(pValue:Boolean, pArgumentName:String, pAdditionalMessage:String = null) {
			super(pValue, pArgumentName, pAdditionalMessage);
		}
		
		public function isTrue(pDescription:String = null):BoolValidator {
			if (_value) return this;
			
			throw _buildException(
				_getFormattedConditionMessage(
					Resources.m_boolTrue, 
					pDescription, 
					_argumentName
				)
			);
		}
		
		public function isFalse(pDescription:String = null):BoolValidator {
			if (!_value) return this;
			
			throw _buildException(
				_getFormattedConditionMessage(
					Resources.m_boolFalse, 
					pDescription, 
					_argumentName
				)
			);
		}
	}
}
